#include "exp_op.h"
#include "multiply_op.h"
#include "../../factory/factory.h"
#include "../../factory/multiply_factory.h"

Exp::Exp(Node* node) : OpNode({node}){
}

vector<Node*> Exp::getGradNodes(Node* grad){
    auto nodes = *getNodeIn();
    Factory* factory = new MultiplyFactory(grad, nodes[0]);
    Node* ret = factory -> createNode();
    delete factory;
    return {ret};
}

void Exp::compute(Context* context){
    auto nodes = *getNodeIn();
    context -> setFlowedData(this,
                     exp(context -> getFlowedData(nodes[0])) );
}
